import request from '@/utils/request'

// 查询采购订单列表
export function listOrder(query) {
  return request({
    url: '/mes/order/list',
    method: 'get',
    params: query
  })
}

// 查询采购订单详细
export function getOrder(id) {
  return request({
    url: '/mes/order/' + id,
    method: 'get'
  })
}

// 根据产品id查询采购订单详细
export function getOrderDetails(proId) {
  return request({
    url: '/mes/order/details/' + proId,
    method: 'get'
  })
}

// 新增采购订单
export function addOrder(data) {
  return request({
    url: '/mes/order',
    method: 'post',
    data: data
  })
}

// 修改-新增采购需求
export function addPurchaseOrder(data) {
  return request({
    url: '/mes/order/purchase-order',
    method: 'post',
    data: data
  })
}

// 修改采购订单
export function updateOrder(data) {
  return request({
    url: '/mes/order',
    method: 'put',
    data: data
  })
}

// 删除采购订单
export function delOrder(id) {
  return request({
    url: '/mes/order/' + id,
    method: 'delete'
  })
}

// 新增采购入库单和修改接口
export function updateOrderAddPut(data) {
  return request({
    url: '/mes/order/put-storage',
    method: 'Post',
    data: data
  })
}
